<template>
  <div class="app-container">    
    <el-table  :data="noticeList">
      <el-table-column type="index" width="55" label="序号" align="center" />
      <el-table-column label="标题" align="center" prop="title"/>
      <el-table-column
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="showNotice(scope.row)"
            >查看</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <notice-view :noticeId="noticeId" @close="hideNotice"></notice-view>
  </div>
</template>

<script>
import NoticeView from "@/components/SchoolNotice";
import { apiDs } from "@/api/openapi";

export default {
  name: "TeachSchedule",
  dicts: [],
  components: {
    NoticeView,
  },
  data() {
    return {
      noticeId: null,
      noticeList: []
    };
  },
  created() {
    apiDs('home_statics_notice').then((response) => {
        this.noticeList = response.data;
    });
  },
  methods: {
    showNotice(row) {
      this.noticeId = row.id;
    },
    hideNotice() {
        this.noticeId = null;
    }
  },
};
</script>
